package cn.jzq.kotoba.modules.designpattern.strategy;

/**
 * @author jzq
 * @date 2019/2/12 13:15
 */
public class StrategyApp {

    public static void main(String[] args) {
        Duck muteDuck = new MuteDuck();
        muteDuck.display();
        muteDuck.doFly();
        muteDuck.doQuack();
        System.out.println("mute duck 做了手术现在可以叫了");
        muteDuck.setQuackBehavior(new Quack());
        muteDuck.doQuack();
        muteDuck.display();

        muteDuck.setQuackBehavior(() -> System.out.println("匿名函数实现 quack"));
        muteDuck.doQuack();
    }
}
